{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class=""><a href="{:url('admin/adv/index')}">广告管理</a></li>
            {//<li class=""><a href="{:url('admin/adv/add')}">添加广告</a></li>
            <li class="layui-this">编辑导航</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form form-container" action="{:url('admin/adv/update')}" method="post" enctype="multipart/form-data">
                    <div class="layui-form-item">
                        <label class="layui-form-label">上级导航</label>
                        <div class="layui-input-block">
                            <select name="cid" required lay-verify="required">
                                {foreach name="adv_level_list" item="vo"}
                                <option value="{$vo.id}" {if condition="$adv.cid==$vo.id"}{/if} {if condition="$adv.cid==$vo.id"} selected="selected"{/if}>{neq name="vo.level" value="1"}|{php}for($i=1;$i<$vo['level'];$i++){echo ' ----';}{/php}{/neq} {$vo.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">广告名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" value="{$adv.title}" required  lay-verify="required" placeholder="请输入标题" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">广告链接</label>
                        <div class="layui-input-block">
                            <input type="text" name="url" value="{$adv.url}" placeholder="（选填）请输入广告url" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" style="display: none;">
                        <label class="layui-form-label">内容</label>
                        <div class="layui-input-block">
                            <textarea name="content" placeholder="" class="layui-textarea" id="content"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">缩略图</label>
                        <div class="layui-input-block">
                            <input type="text" name="advimage" value="{$adv.advimage}" class="layui-input layui-input-inline" id="thumb">
                            <input type="file" name="file" class="layui-upload-file">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">宽</label>
                        <div class="layui-input-block"  style="margin-bottom: 17px;">
                            <input type="text" name="width" value="{$adv.width}" id="width" class="layui-input layui-input-inline">
                            <label style="width:20px;left: -20px;" class="layui-form-label">高</label>
                            <input style="left: -20px;" type="text" name="height" value="{$adv.height}" id="height" class="layui-input layui-input-inline">
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">图集</label>
                            <div class="layui-input-block">
                                <button type="button" id="upload-photo-btn" class="layui-btn">上传图集</button>
                                <div id="photo-container"></div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">发布时间</label>
                            <div class="layui-input-block">
                                <input type="text" name="create_time" value="{:date('Y-m-d H:i:s')}" class="layui-input datetime">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">排序</label>
                            <div class="layui-input-block">
                                <input type="text" name="sort" value="0" required  lay-verify="required" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-input-block">
                                <textarea name="remark" placeholder="（选填）请输入备注" class="layui-textarea">{$adv.remark}</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="hidden" name="id" value="{$adv.id}" />
                                <button class="layui-btn" type="submit">修改</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}